<?php slot('title','Table '.$id_table_client);
	use_stylesheet('commandeParTable.css');
	use_javascript('visibility.js');
	$url = '<a href="'.url_for('tableClient/index?id_serveur='.$_SESSION['id_serveur']).'"><img src="/ProjetBar/web/images/retour.png" width="50"/></a>';
	slot('retour',$url);
?>
<table>
	<?php $i = 0; ?>
	<?php foreach($commandes_par_table as $commande_par_table){ ?>
		<?php
		$nb_produit_pret = 0;
		foreach($commande_notification_cartes as $commande_notification_carte){
			if($commande_notification_carte['id_commande_client'] == $commande_par_table->getIdCommandeClient()){
				$nb_produit_pret = $commande_notification_carte['nb_produit_pret'];
			}
		}
		foreach($commande_notification_menus as $commande_notification_menu){
			if($commande_notification_menu['id_commande_client'] == $commande_par_table->getIdCommandeClient()){
				$nb_produit_pret += $commande_notification_menu['nb_produit_pret'];
			}
		}
		?>
		<tr>
		<td id="notif">
			<?php if($nb_produit_pret){ echo "<img src='/ProjetBar/web/images/icone_alerte.gif' alt='' height='20' width='20'/>"; echo $nb_produit_pret;} ?></td>
		<td id="commande"><a href="<?php echo url_for('commandeClient/show?id_commande_client='.$commande_par_table->getIdCommandeClient());?>">	
			<?php echo "COMMANDE ".$commande_par_table->getIdCommandeClient(); ?></a></td>
		<td></td>
		<?php if($commande_par_table->getIdEtatCommande() == 3){ ?>
		<td><a href="<?php echo url_for('commandeClient/commandePrete?id_commande_client='.$commande_par_table->getIdCommandeClient().'&id_table_client='.$id_table_client); ?>">
			<img src='/ProjetBar/web/images/valider.png' alt='' height='20' width='20'/></a></td>
		<?php }else{?>
		<td onclick="javascript:visibilite('<?php echo 'modePaiement'.$i; ?>');" />
			<img src='/ProjetBar/web/images/mode_paiement.png' alt='' height='20' width='20'/></td>
		<?php }?>
		<td><a href="<?php echo url_for('commandeClient/delete?id_commande_client='.$commande_par_table->getIdCommandeClient().'&id_table_client='.$id_table_client); ?>">
			<img src='/ProjetBar/web/images/annuler.png' alt='' height='20' width='20'/></a></td>
		</tr>
		<tr id="<?php echo 'modePaiement'.$i?>" style="display: none;">
			<td></td>
			<td></td>	
			<td><a href="<?php echo url_for('modePaiement/paiement?id_commande_client='.$commande_par_table->getIdCommandeClient().'&id_type_paiement=2&id_table_client='.$id_table_client.''); ?>">
				<img src='/ProjetBar/web/images/cb.png' height='20' width='20'/></a></td>
			<td><a href="<?php echo url_for('modePaiement/paiement?id_commande_client='.$commande_par_table->getIdCommandeClient().'&id_type_paiement=1&id_table_client='.$id_table_client.''); ?>">
				<img src='/ProjetBar/web/images/espece.png' height='20' width='20'/><a></td>
			<td><a href="<?php echo url_for('modePaiement/paiement?id_commande_client='.$commande_par_table->getIdCommandeClient().'&id_type_paiement=3&id_table_client='.$id_table_client.''); ?>">
				<img src='/ProjetBar/web/images/cheque.png' height='20' width='20'/></a></td>
		</tr>
		<?php $i++; ?>
	<?php } ?>
</table>

<div id="newCommande">
	<a href="<?php echo url_for('commandeClient/new?id_table_client='.$id_table_client); ?>"><img src='/ProjetBar/web/images/plus.png' height='20' width='20'/>Nouvelle commande<a>
</div>